<%-- 
    Document   : smsType2
    Created on : 11 Jan, 2013, 6:57:23 PM
    Author     : sagar
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="../common/script.jsp" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <%@include file="../common/title.jsp" %>
        <script type="text/javascript">
            function selectSms(){
                var id1=document.getElementById("centerId").value;
                var id2=document.getElementById("centerId");
                
                var centreName = id2.options[id2.selectedIndex].text;
                $.ajax({
                    data: ({'centerId1' : id1}),
                    url: "../getCenterInfo.htm",
                    dataType: "json",
                    success:function(json){
                        if(json!=null){
                            
                            var centerAddress=json.address;
                            var centerPhoneNo=json.phoneNumber;
                            var msBody="Dear ${customer.customerName} , As per you request:\n\
Healthspring "+centreName+ " Centre is at "+centerAddress+" \n\
Call "+centerPhoneNo;
   
            
                            document.getElementById("smsType2").value=msBody;
                        }else{
                            //document.getElementById("area").value='N/A';
                            //document.getElementById("masterZone").value='N/A';
                        }
                    },
                    error: function(e){
                        
                        alert("Error:  Please Enter Zipcode ");
                    }
                });
                //var msBody=document.getElementById("smsType").value="Healthspring "+centreName+ " Centre is at xyz Call 9870342575";
            }
            
        </script>
        <script type="text/javascript">
            var rules=new Array();
            rules[0]='centerId|required|please Select center';
        </script>

    </head>
    <body onLoad="yav.init('form1',rules,'inline');">
        <%@include file="../common/header.jsp" %>
        <%@include file="../common/menu.jsp" %>
        <div class="in_02">
            <form:form id="form1" name="form1"  method="POST">
                <fieldset>
                    <legend>Sending SMS For - ${smsTemplateName}</legend>
                    <table class="formTable">
                        <tr>
                            <td> <spring:message code="centerName"/>:<br/>
                                <select id="centerId" name="centerId"  class="userInputMedium" onchange="selectSms();">
                                    <option value="" label="-"></option>
                                    <c:forEach items="${centerList}" var="list">
                                        <option value="${list.centerId}">${list.centerName}</option>
                                    </c:forEach>
                                </select><br/>
                                 <span id="errorsDiv_centerId"></span><br/>
                            </td>
                            <td><input type="hidden" name="smsTypeId" id="smsTypeId" value="${smsType.smsTypeId}"/></td>
                        </tr>  
                        <tr>
                            <td><span class="HeadingForSms"><b>Query About Cetre</b></span><br/><br/>
                                Message :<br/>
                                <textarea id="smsType2" name="smsType2"  value="${msBody}" class="TextAreaForSms" readonly=""/></textarea><br/>
                            </td>
                        </tr>
                        <tr>
                        <td><input type="submit" name="_finish"  value="<spring:message code="button.sendSms"/>" onclick="return yav.performCheck('form1', rules, 'inline'); "/>
                        <input type="submit" name="_cancel"  value="<spring:message code="button.Cancel"/>"/></td>
                        </tr>
                    </table>
                </fieldset>
            </form:form>
        </div>
    </body>
</html>
